#pragma once

template<typename T>
struct Node {
    T data;
    Node<T> *next;
    Node<T> *prev;

    explicit Node(T data) : data(data), next(nullptr), prev(nullptr)
    {
    }

    Node(const Node& other)
        : data(other.data),
          next(other.next),
          prev(other.prev)
    {
    }

    Node(Node&& other) noexcept
        : data(std::move(other.data)),
          next(other.next),
          prev(other.prev)
    {
    }

    Node& operator=(const Node& other)
    {
        if (this == &other)
            return *this;
        data = other.data;
        next = other.next;
        prev = other.prev;
        return *this;
    }

    Node& operator=(Node&& other) noexcept
    {
        if (this == &other)
            return *this;
        data = std::move(other.data);
        next = other.next;
        prev = other.prev;
        return *this;
    }
};
